package org.xb.ControlAccessProxy;

/**
 * @Author
 * @Description
 * @Date created in 11:41 2023/12/7
 */
public class ProxyUserService implements UserService{
    protected RealUserService realUserService;

    public ProxyUserService( RealUserService realUserService) {
        this.realUserService = realUserService;
    }

    @Override
    public void performAction(String username) {
        if (isAdmin(username)){
            realUserService.performAction(username);
        }else{
            System.out.println("对不起,您没有权限执行");
        }
    }
    public boolean isAdmin(String userName){
        return userName.equals("admin");
    }
}
